$(document).ready(function() {
   
    if($.cookie("lastPartnersList")) {
        var flag = $.cookie("lastPartnersList");
        
        if(flag=='show')
            {
                $('#lastPartnersList').show();
                $('#lastPartnersList .hidePartnersList').removeClass('close_eyes');
            }
            else
                {
                $('#lastPartnersList').hide();    
                $('.hidePartnersList','.new_partner_block_head').addClass('close_eyes');
                }
    
    }
    
    
   
    
    
  
   var ids = $('.category_block_wrap').find('.category_home_block');
   jQuery.each(ids, function() 
   {
      if($.cookie(this.id))
      {   
        
        if($.cookie(this.id)=='hide')
            {   
               
               $("#" + this.id).addClass('category_home_block_close');
               $('.partnersList',"#" + this.id).hide();
                $('.hidePartners',"#" + this.id).addClass('close_eyes');
               
            }
           
      }

    });
   
   
  

    $('.hidePartners').click(function(){
            if($(this).parent().parent().children('.partnersList').css('display') != 'none') {
            $(this).addClass('close_eyes');
            $(this).parent().parent().children('.partnersList').slideUp(300, function(){
            $(this).parent().addClass('category_home_block_close');
//             console.log('Zakrit: '+$(this).parent().attr('id'));
             $.cookie($(this).parent().attr('id'), 'hide');
            });
        } else {
            $(this).removeClass('close_eyes');
            $(this).parent().parent().removeClass('category_home_block_close');
            $(this).parent().parent().children('.partnersList').slideDown(300);
//            console.log('Otkrit: '+ $(this).parent().parent().attr('id'));
            $.cookie($(this).parent().parent().attr('id'), 'show');
        } 
    });
    
    $('.hidePartnersList').click(function() {
        if($('#lastPartnersList').css('display') != 'none') {
            $.cookie("lastPartnersList", 'hide');
            $(this).addClass('close_eyes');
            $('#lastPartnersList').slideUp(300);
        } else {
            $(this).removeClass('close_eyes');
            $('#lastPartnersList').slideDown(300);
            $.cookie("lastPartnersList", 'show');
        }
    });
    
    $('.logotypeMenu').click(function() {
        if($('.logoMenu').css('display') == 'none') {
           $('.logoMenu').css('display', 'block'); 
        } else {
           $('.logoMenu').css('display', 'none');
        }
    });
});